#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QListWidgetItem>
#include "dialogmkdir.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
	Q_OBJECT

public:
	explicit MainWindow(QWidget *parent = 0);
	~MainWindow();

private slots:
    //void onClear();
	void serialConnect();
	void onDisconnect();
	void onConnected();
	void onUnconnected();
	void onSerialError(QSerialPort::SerialPortError error);
    //void onSend_btn();
    void onRefreshFileList();
    void onItemSelected(QListWidgetItem *item);
    void onDoubleClicked(QListWidgetItem *item);
    void onDownloadFile(QListWidgetItem *item);
    void onChangePWD(QListWidgetItem *item);
	void onBaudChanged();

    void sendCmd(QString CMD, QString ARG);
    void addFile();
    void onMkdirDialog();
    void onCreateDir(const QString& foldername);
    QStringList parseRecFileData(QString DATA);
private:
	Ui::MainWindow *ui;
    DialogMkdir *dialogMkdir;
	QSerialPort serial;
	QSerialPort::BaudRate baud_;
    QString pwd;
    QString currentCmd;
    QString fileRecString;
};

#endif // MAINWINDOW_H
